package cn.chen.数据结构.链表;

public class SingleLinkedListTest {

    public static void main(String[] args){

        // 创建链表
        SingleLinkedList list=new SingleLinkedList();
        // 往链表中添加元素
        list.addNode(new HeroNode(1,"chen","wan"));
        list.addNode(new HeroNode(2,"chen2","wan2"));
        list.addNode(new HeroNode(5,"chen3","wan3"));
        list.addNode(new HeroNode(10,"chen4","wan4"));
        list.insertNode(new HeroNode(3,"chen4","wan4"));
        list.insertNode(new HeroNode(7,"chen4","wan4"));
        list.insertNode(new HeroNode(11,"chen4","wan4"));

        list.show();
        list.updateNode(new HeroNode(11,"chen444","wan444"));
        System.out.println("修改之后");

        list.show();

        list.removeNode(7);
        System.out.println("删除之后");
        // 显示链表
        list.show();

        System.out.println(list.length());
        System.out.println(list.getNode(3));

        System.out.println("==============");


        list.reverse();
        list.show();

        System.out.println("反向遍历");
        list.lastShow();
    }
}
